﻿package plugin.duanzao.component
{
    import flash.events.*;
    import uiresource.*;

    public class TileItem2 extends TileItem2UI
    {
        private var _data:Object = null;
        private var _selected:Boolean = false;
        private var _ClickHandler:Function;

        public function TileItem2(param1:Function)
        {
            this.selected = false;
            this._ClickHandler = param1;
            this.addEventListener(MouseEvent.CLICK, this.triggeredHandler);
            return;
        }// end function

        public function get selected() : Boolean
        {
            return this._selected;
        }// end function

        public function set selected(param1:Boolean) : void
        {
            this._selected = param1;
            normal.visible = !this._selected;
            select.visible = this._selected;
            return;
        }// end function

        public function showimg(param1:int) : void
        {
            if (param1 > 0)
            {
                ctxt.text = "(" + param1 + ")";
                ctxt.visible = true;
            }
            else
            {
                ctxt.visible = false;
            }
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            this._data = param1;
            btn.label = this.data.titlename;
            return;
        }// end function

        public function get data() : Object
        {
            return this._data;
        }// end function

        private function triggeredHandler(event:MouseEvent) : void
        {
            this._ClickHandler(this.data.titltype, this._selected);
            return;
        }// end function

    }
}
